

* Set this Working Directory to the Folder with the Replication Files
cd "C:/Steven/GDrive/Research Files/Clark-Rogers/Descriptive Representation/APSR Final Submission/Replication/"

****
* In this file, estimates (e.g., coefficients, standard errors, predicted probabilities) are generated and exprted to the
* Scripts/Figures/Estimates folder.  Figures themselves are then built in R to be consistent with Stauffer's appearance
****

****
* Estimates for Figure 1
****

* Generate Estimates from Stauffer Data

	* Congress
		use "Data/Formatted Data/Stauffer-Congress-RegressionData.dta", clear 
		quietly xtmixed efficacy_1 Belief_WomenCongress Female Ideology Independent Republican StrongPartisan ///
				FederalKnowledge Religiosity CollegeDegree White Age c.Age#c.Age Employed ///
				USSenator_Female MoC_Female True_WomenStateLeg i.year || State:

		eststo CurrentCoefTable
		esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Stauffer-Congress.csv", replace ///
		ci 
		eststo clear

	* State Leg
	use "Data/Formatted Data/Stauffer-StateLeg-RegressionData.dta", clear 
	quietly meoprobit RepPeopleLikeMe_StateLeg True_WomenStateLeg Belief_WomenStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns)

	eststo CurrentCoefTable
	esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Stauffer-StateLeg.csv", replace ///
	ci 
	eststo clear
	
	
* Estimates from Clark Rogers Data

	use "Data/Formatted Data/Clark-Rogers-RegressionData.dta", clear

	* Women Congress
		quietly xtmixed ExternalEfficacy_Congress Belief_WomenCongress Female Ideology Independent Republican StrongPartisan ///
				FederalKnowledge Religiosity CollegeDegree White Age c.Age#c.Age Employed ///
				USSenator_Female MoC_Female True_WomenStateLeg || State:
								
		eststo CurrentCoefTable
		esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Clark-Rogers-Congress-Women.csv", replace ///
		ci 
		eststo clear
	
	* Women State Leg
		quietly meoprobit RepPeopleLikeMe_StateLeg True_WomenStateLeg Belief_WomenStateLeg c.True_WomenStateLeg#c.Female Female c.Belief_WomenStateLeg#c.Female  ///
				Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Independent Republican StrongPartisan StateKnowledge Age c.Age#c.Age ///
				White CollegeDegree Employed Religiosity ||State: , cov(uns) 
	
		eststo CurrentCoefTable
		esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Clark-Rogers-StateLeg-Women.csv", replace ///
		ci 
		eststo clear
	
	* Blacks Congress
		quietly xtmixed ExternalEfficacy_Congress Belief_BlackCongress Female Ideology Independent Republican StrongPartisan ///
				FederalKnowledge Religiosity CollegeDegree Black Age c.Age#c.Age Employed ///
				USSenator_Black MoC_Black True_BlackStateLeg || State:
				
			eststo CurrentCoefTable
			esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Clark-Rogers-Congress-Blacks.csv", replace ///
			ci 
			eststo clear

	* Blacks State Leg
		quietly meoprobit RepPeopleLikeMe_StateLeg True_BlackStateLeg Belief_BlackStateLeg  Female Black ///
				Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Independent Republican StrongPartisan StateKnowledge Age c.Age#c.Age ///
				CollegeDegree Employed Religiosity ||State: , cov(uns) 
				
			eststo CurrentCoefTable
			esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Clark-Rogers-StateLeg-Blacks.csv", replace ///
			ci 
			eststo clear

*****
* Estimates for Figure 4
*****

	* Women Congress
		quietly meoprobit Trust_Congress_Pre Belief_WomenCongress Female Ideology Independent Republican StrongPartisan ///
				FederalKnowledge Religiosity CollegeDegree White Age c.Age#c.Age Emp
	
		eststo CurrentCoefTable
		esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Clark-Rogers-Congress-Women-Trust.csv", replace ///
		ci 
		eststo clear
	
	* Women State Leg
		quietly meoprobit Trust_StateLeg_Pre True_WomenStateLeg Belief_WomenStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns) 
		
		eststo CurrentCoefTable
		esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Clark-Rogers-StateLeg-Women-Trust.csv", replace ///
		ci 
		eststo clear
	
	* Blacks Congress
		quietly meoprobit Trust_Congress_Pre Belief_BlackCongress Female Ideology Independent Republican StrongPartisan ///
		FederalKnowledge Religiosity CollegeDegree Black Age c.Age#c.Age Employed ///
		USSenator_Black MoC_Black True_BlackStateLeg  ||State: , cov(uns) 
		
		eststo CurrentCoefTable
		esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Clark-Rogers-Congress-Blacks-Trust.csv", replace ///
		ci 
		eststo clear

	* Blacks State Leg
		quietly  meoprobit Trust_StateLeg_Pre True_BlackStateLeg Belief_BlackStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age Black CollegeDegree Employed Religiosity||State: , cov(uns) 
				
		eststo CurrentCoefTable
		esttab CurrentCoefTable  using "Scripts/Figures/Estimates/Clark-Rogers-StateLeg-Blacks-Trust.csv", replace ///
		ci 
		eststo clear

************
* APPENDIX *
************
		
* Estimates for Figure A-4

****
* Stauffer
****

		use "Data/Formatted Data/Stauffer-Congress-RegressionData.dta", clear 

		quietly xtmixed efficacy_1 c.r_estimate gender_r c.ideo7 i.party strong_partisan know_fed religiosity ///
		coll white c.age##c.age employed woman_sen woman_rep c.stateleg i.year || state:
		
		quietly mgen, at(r_estimate=(0(10)60) gender_r==1 white==1 employed==0 party==1 ///
		strong_partisan==0 year==2018 woman_sen==0 woman_rep==0) ///
		atmeans stub(pooled) replace 

		tab pooledmargin
		eststo clear
		eststo: estpost tab pooledmargin
		esttab using "Scripts/Figures/Estimates/Stauffer-FigureA4-Margins.csv", replace

		tab pooledll
		eststo clear
		eststo: estpost tab pooledll
		esttab using "Scripts/Figures/Estimates/Stauffer-FigureA4-lowerbound.csv", replace

		tab pooledul
		eststo clear
		eststo: estpost tab pooledul
		esttab using "Scripts/Figures/Estimates/Stauffer-FigureA4-upperbound.csv", replace

**
* Clark-Rogers - Gender
****
	use "Data/Formatted Data/Clark-Rogers-RegressionData.dta", clear


		*Generate Predictions for Plots
		quietly xtmixed ExternalEfficacy_Congress Belief_WomenCongress Female Ideology Independent Republican StrongPartisan ///
				FederalKnowledge Religiosity CollegeDegree White Age c.Age#c.Age Employed ///
				USSenator_Female MoC_Female True_WomenStateLeg || State:

		quietly mgen, at(Belief_WomenCongress=(0(10)60) Female==1 White==1 Employed==0 Independent==1 Republican==0 ///
		StrongPartisan==0 USSenator_Female==0 MoC_Female==0) ///
		atmeans stub(pooled) replace 

		tab pooledmargin
		eststo clear
		eststo: estpost tab pooledmargin
		esttab using "Scripts/Figures/Estimates/Rogers-FigureA4-Gender-Margins.csv", replace

		tab pooledll
		eststo clear
		eststo: estpost tab pooledll
		esttab using "Scripts/Figures/Estimates/Rogers-FigureA4-Gender-lowerbound.csv", replace

		tab pooledul
		eststo clear
		eststo: estpost tab pooledul
		esttab using "Scripts/Figures/Estimates/Rogers-FigureA4-Gender-upperbound.csv", replace
		
**
* Clark-Rogers - Race
****

		*Generate Predictions for Plots
		quietly: xtmixed ExternalEfficacy_Congress Belief_BlackCongress Female Ideology Independent Republican StrongPartisan ///
				FederalKnowledge Religiosity CollegeDegree Black Age c.Age#c.Age Employed ///
				USSenator_Black MoC_Black True_BlackStateLeg || State:

		quietly mgen, at(Belief_BlackCongress=(0(10)60) Female==1 Black==0 Employed==0 Independent==1 Republican==0 ///
		StrongPartisan==0 USSenator_Black==0 MoC_Black==0) ///
		atmeans stub(pooled) replace 

		tab pooledmargin
		eststo clear
		eststo: estpost tab pooledmargin
		esttab using "Scripts/Figures/Estimates/Rogers-FigureA4-Race-Margins.csv", replace

		tab pooledll
		eststo clear
		eststo: estpost tab pooledll
		esttab using "Scripts/Figures/Estimates/Rogers-FigureA4-Race-lowerbound.csv", replace

		tab pooledul
		eststo clear
		eststo: estpost tab pooledul
		esttab using "Scripts/Figures/Estimates/Rogers-FigureA4-Race-upperbound.csv", replace

****
* Estimates forFigure A-5
***

* For Panel A, Clark and Rogers use Stauffer's Replication file figure_3.tab available on Dataverse

***
* Estimates for A-5 Panel B
***

quietly meoprobit RepPeopleLikeMe_StateLeg True_WomenStateLeg Belief_WomenStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns) 
				
	    quietly mgen, predict(outcome(-2) fixedonly) at(Belief_WomenStateLeg=(0(5)60) Female==1 Congruence==0 White==1 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(women1) replace

		tab women1margin
		eststo clear
		eststo: estpost tab women1margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Neg2-Margins.csv", replace

		tab women1ll
		eststo clear
		eststo: estpost tab women1ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Neg2-lowerbound.csv", replace

		tab women1ul
		eststo clear
		eststo: estpost tab women1ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Neg2-upperbound.csv", replace
		
quietly meoprobit RepPeopleLikeMe_StateLeg True_WomenStateLeg Belief_WomenStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns) 
						
		quietly mgen, predict(outcome(-1) fixedonly) at(Belief_WomenStateLeg=(0(5)60) Female==1 Congruence==0 White==1 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(women2) replace

		tab women2margin
		eststo clear
		eststo: estpost tab women2margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Neg1-Margins.csv", replace

		tab women2ll
		eststo clear
		eststo: estpost tab women2ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Neg1-lowerbound.csv", replace

		tab women2ul
		eststo clear
		eststo: estpost tab women2ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Neg1-upperbound.csv", replace
		

quietly meoprobit RepPeopleLikeMe_StateLeg True_WomenStateLeg Belief_WomenStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns) 
		
		quietly mgen, predict(outcome(0) fixedonly) at(Belief_WomenStateLeg=(0(5)60) Female==1 Congruence==0 White==1 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(women3) replace

		tab women3margin
		eststo clear
		eststo: estpost tab women3margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Zero-Margins.csv", replace

		tab women3ll
		eststo clear
		eststo: estpost tab women3ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Zero-lowerbound.csv", replace

		tab women3ul
		eststo clear
		eststo: estpost tab women3ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Zero-upperbound.csv", replace

quietly meoprobit RepPeopleLikeMe_StateLeg True_WomenStateLeg Belief_WomenStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns) 
		
		quietly mgen, predict(outcome(1) fixedonly) at(Belief_WomenStateLeg=(0(5)60) Female==1 Congruence==0 White==1 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(women4) replace

		tab women4margin
		eststo clear
		eststo: estpost tab women4margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Pos1-Margins.csv", replace

		tab women4ll
		eststo clear
		eststo: estpost tab women4ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Pos1-lowerbound.csv", replace

		tab women4ul
		eststo clear
		eststo: estpost tab women4ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Pos1-upperbound.csv", replace

quietly meoprobit RepPeopleLikeMe_StateLeg True_WomenStateLeg Belief_WomenStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns) 
		
		quietly mgen, predict(outcome(2) fixedonly) at(Belief_WomenStateLeg=(0(5)60) Female==1 Congruence==0 White==1 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(women5) replace

		tab women5margin
		eststo clear
		eststo: estpost tab women5margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Pos2-Margins.csv", replace

		tab women5ll
		eststo clear
		eststo: estpost tab women5ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Pos2-lowerbound.csv", replace

		tab women5ul
		eststo clear
		eststo: estpost tab women5ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Gender-Outcome-Pos2-upperbound.csv", replace

		
***
* Estimates for A-5 Panel C
***
				

quietly meoprobit RepPeopleLikeMe_StateLeg True_BlackStateLeg Belief_BlackStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age Black CollegeDegree Employed Religiosity||State: , cov(uns) 
				
		mgen, predict(outcome(-2) fixedonly) at(Belief_BlackStateLeg=(0(5)60) Female==1 Congruence==0 Black==0 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(black1) replace

		tab black1margin
		eststo clear
		eststo: estpost tab black1margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Neg2-Margins.csv", replace

		tab black1ll
		eststo clear
		eststo: estpost tab black1ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Neg2-lowerbound.csv", replace

		tab black1ul
		eststo clear
		eststo: estpost tab black1ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Neg2-upperbound.csv", replace
		
quietly meoprobit RepPeopleLikeMe_StateLeg True_BlackStateLeg Belief_BlackStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age Black CollegeDegree Employed Religiosity||State: , cov(uns) 
						
		quietly mgen, predict(outcome(-1) fixedonly) at(Belief_BlackStateLeg=(0(5)60) Female==1 Congruence==0 Black==0 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(black2) replace

		tab black2margin
		eststo clear
		eststo: estpost tab black2margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Neg1-Margins.csv", replace

		tab black2ll
		eststo clear
		eststo: estpost tab black2ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Neg1-lowerbound.csv", replace

		tab black2ul
		eststo clear
		eststo: estpost tab black2ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Neg1-upperbound.csv", replace
		

quietly meoprobit RepPeopleLikeMe_StateLeg True_BlackStateLeg Belief_BlackStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age Black CollegeDegree Employed Religiosity||State: , cov(uns) 
		
		quietly mgen, predict(outcome(0) fixedonly) at(Belief_BlackStateLeg=(0(5)60) Female==1 Congruence==0 Black==0 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(black3) replace

		tab black3margin
		eststo clear
		eststo: estpost tab black3margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Zero-Margins.csv", replace

		tab black3ll
		eststo clear
		eststo: estpost tab black3ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Zero-lowerbound.csv", replace

		tab black3ul
		eststo clear
		eststo: estpost tab black3ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Zero-upperbound.csv", replace

quietly meoprobit RepPeopleLikeMe_StateLeg True_BlackStateLeg Belief_BlackStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age Black CollegeDegree Employed Religiosity||State: , cov(uns) 
		
		quietly mgen, predict(outcome(1) fixedonly) at(Belief_BlackStateLeg=(0(5)60) Female==1 Congruence==0 Black==0 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(black4) replace

		tab black4margin
		eststo clear
		eststo: estpost tab black4margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Pos1-Margins.csv", replace

		tab black4ll
		eststo clear
		eststo: estpost tab black4ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Pos1-lowerbound.csv", replace

		tab black4ul
		eststo clear
		eststo: estpost tab black4ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Pos1-upperbound.csv", replace

quietly meoprobit RepPeopleLikeMe_StateLeg True_BlackStateLeg Belief_BlackStateLeg Female Ideology State_Ideology c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge ///
		Age c.Age#c.Age Black CollegeDegree Employed Religiosity||State: , cov(uns) 
		
		quietly mgen, predict(outcome(2) fixedonly) at(Belief_BlackStateLeg=(0(5)60) Female==1 Congruence==0 Black==0 Employed==0 ///
		Independent==1 Republican==0  StrongPartisan==0) atmeans stub(black5) replace

		tab black5margin
		eststo clear
		eststo: estpost tab black5margin
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Pos2-Margins.csv", replace

		tab black5ll
		eststo clear
		eststo: estpost tab black5ll
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Pos2-lowerbound.csv", replace

		tab black5ul
		eststo clear
		eststo: estpost tab black5ul
		esttab using "Scripts/Figures/Estimates/ClarkRogers-FigureA-5-Race-Outcome-Pos2-upperbound.csv", replace 
				
		
*****
* Estimates for Figure A-6
*****

	use "Data/Formatted Data/Clark-Rogers-RegressionData.dta", clear
	* Clark-Rogers ~  Congress ~ Sexism
		gen CurrentSexismValue = 0
		gen CurrentSexismValueforFileValue=0
		local CurrentSexismValueForFile = CurrentSexismValueforFileValue
		gen FemTeslerTemp =.

		forval i=1/11 {
		eststo clear		
		quietly xtmixed ExternalEfficacy_Congress Belief_WomenCongress Fem_Tesler c.Belief_WomenCongress#c.Fem_Tesler Female Ideology Independent Republican StrongPartisan ///
				FederalKnowledge Religiosity CollegeDegree White Age c.Age#c.Age Employed ///
				USSenator_Female MoC_Female True_WomenStateLeg || State:
		
		replace FemTeslerTemp=Fem_Tesler
		replace Fem_Tesler=CurrentSexismValue
		margins, at((mean) Fem_Tesler Belief_WomenCongress = (31 48)) contrast(atcontrast(r._at) nowald) post
		
		esttab using "Scripts/Figures/Estimates/Racial Resentment/Congress-Sexism-`CurrentSexismValueForFile'.csv", label ci scalars(cmdline) nogaps nonumbers nostar replace
		replace Fem_Tesler=FemTeslerTemp
		replace CurrentSexismValue = CurrentSexismValue+.1
		replace CurrentSexismValueforFileValue = CurrentSexismValueforFileValue+10
		local CurrentSexismValueForFile = CurrentSexismValueforFileValue
		}
		
		drop CurrentSexismValue
		drop CurrentSexismValueforFileValue
		drop FemTeslerTemp

***
* Estimates for Figure A-7
***
		
*  Congress Trust ~ Sexism	

		gen CurrentSexismValue = 0
		gen CurrentSexismValueforFileValue=0
		local CurrentSexismValueForFile = CurrentSexismValueforFileValue
		gen FemTeslerTemp =.

		forval i=1/11 {
		eststo clear		
		quietly meoprobit Trust_Congress_Pre Belief_WomenCongress Fem_Tesler c.Fem_Tesler#c.Belief_WomenCongress Female Ideology Independent Republican StrongPartisan FederalKnowledge Religiosity CollegeDegree White Age c.Age#c.Age Emp
		
		replace FemTeslerTemp=Fem_Tesler
		replace Fem_Tesler=CurrentSexismValue
		margins, at((mean) Fem_Tesler Belief_WomenCongress = (31 48)) contrast(atcontrast(r._at) nowald) post
		
		esttab using "Scripts/Figures/Estimates/Racial Resentment/Congress-Trust-Sexism-`CurrentSexismValueForFile'.csv", label ci scalars(cmdline) nogaps nonumbers nostar replace
		replace Fem_Tesler=FemTeslerTemp
		replace CurrentSexismValue = CurrentSexismValue+.1
		replace CurrentSexismValueforFileValue = CurrentSexismValueforFileValue+10
		local CurrentSexismValueForFile = CurrentSexismValueforFileValue
		}
		
		drop CurrentSexismValue
		drop CurrentSexismValueforFileValue
		drop FemTeslerTemp

		* Congress ~ Racial Resentment

		gen CurrentRRValue = 0
		gen CurrentRRValueforFileValue=0
		local CurrentRRValueForFile = CurrentRRValueforFileValue
		gen RRTeslerTemp =.

		forval i=1/11 {
		eststo clear		
		quietly xtmixed ExternalEfficacy_Congress Belief_BlackCongress RR_Tesler c.RR_Tesler#c.Belief_BlackCongress Female Ideology Independent Republican StrongPartisan ///
				FederalKnowledge Religiosity CollegeDegree Black Age c.Age#c.Age Employed ///
				USSenator_Black MoC_Black True_BlackStateLeg || State:
		
		replace RRTeslerTemp=RR_Tesler
		replace RR_Tesler=CurrentRRValue
		margins, at((mean) RR_Tesler Belief_BlackCongress = (31 48)) contrast(atcontrast(r._at) nowald) post
		
		esttab using "Scripts/Figures/Estimates/Racial Resentment/Congress-RacialResentment-`CurrentRRValueForFile'.csv", label ci scalars(cmdline) nogaps nonumbers nostar replace
		replace RR_Tesler=RRTeslerTemp
		replace CurrentRRValue = CurrentRRValue+.1
		replace CurrentRRValueforFileValue = CurrentRRValueforFileValue+10
		local CurrentRRValueForFile = CurrentRRValueforFileValue
		}
		
		drop CurrentRRValue
		drop CurrentRRValueforFileValue
		drop RRTeslerTemp
		
***
* Estimates for Figure A-8
***
		
*  State Leg ~ Sexism - Trust

		gen CurrentSexismValue = 0
		gen CurrentSexismValueforFileValue=0
		local CurrentSexismValueForFile = CurrentSexismValueforFileValue
		gen FemTeslerTemp =.

		forval i=1/11 {
		eststo clear		
		quietly meoprobit Trust_StateLeg_Pre Belief_WomenStateLeg True_WomenStateLeg Fem_Tesler Female c.Belief_WomenStateLeg#c.Fem_Tesler c.True_WomenStateLeg#c.Fem_Tesler Ideology ///
		State_Ideology  c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns)
		
		replace FemTeslerTemp=Fem_Tesler
		replace Fem_Tesler=CurrentSexismValue
		margins, at((mean) Fem_Tesler Belief_WomenStateLeg = (31 48)) contrast(atcontrast(r._at) nowald) post
		
		esttab using "Scripts/Figures/Estimates/Racial Resentment/StateLeg-Trust-Sexism-`CurrentSexismValueForFile'.csv", label ci scalars(cmdline) nogaps nonumbers nostar replace
		replace Fem_Tesler=FemTeslerTemp
		replace CurrentSexismValue = CurrentSexismValue+.1
		replace CurrentSexismValueforFileValue = CurrentSexismValueforFileValue+10
		local CurrentSexismValueForFile = CurrentSexismValueforFileValue
		}
		
		drop CurrentSexismValue
		drop CurrentSexismValueforFileValue
		drop FemTeslerTemp

***
* Estimates for Figure A-9
***
		
	* State Leg ~ Sexism - Responsiveness
		gen CurrentSexismValue = 0
		gen CurrentSexismValueforFileValue=0
		local CurrentSexismValueForFile = CurrentSexismValueforFileValue
		gen FemTeslerTemp =.

		forval i=1/11 {
		eststo clear		
		quietly meoprobit RepPeopleLikeMe_StateLeg Belief_WomenStateLeg True_WomenStateLeg Fem_Tesler Female c.Belief_WomenStateLeg#c.Fem_Tesler c.True_WomenStateLeg#c.Fem_Tesler Ideology ///
		State_Ideology  c.Ideology#c.State_Ideology Congruence Republican Independent StrongPartisan StateKnowledge Age c.Age#c.Age White CollegeDegree Employed Religiosity||State: , cov(uns)
		
		replace FemTeslerTemp=Fem_Tesler
		replace Fem_Tesler=CurrentSexismValue
		margins, at((mean) Fem_Tesler Belief_WomenStateLeg = (31 48)) contrast(atcontrast(r._at) nowald) post
		
		esttab using "Scripts/Figures/Estimates/Racial Resentment/StateLeg-Sexism-`CurrentSexismValueForFile'.csv", label ci scalars(cmdline) nogaps nonumbers nostar replace
		replace Fem_Tesler=FemTeslerTemp
		replace CurrentSexismValue = CurrentSexismValue+.1
		replace CurrentSexismValueforFileValue = CurrentSexismValueforFileValue+10
		local CurrentSexismValueForFile = CurrentSexismValueforFileValue
		}
		
		drop CurrentSexismValue
		drop CurrentSexismValueforFileValue
		drop FemTeslerTemp		


***
* Estimates for Figure A-10
***				

		
* State Leg ~ Racial Resentment

		gen CurrentRRValue = 0
		gen CurrentRRValueforFileValue=0
		local CurrentRRValueForFile = CurrentRRValueforFileValue
		gen RRTeslerTemp =.

		forval i=1/11 {
		eststo clear		
		quietly meoprobit RepPeopleLikeMe_StateLeg True_BlackStateLeg Belief_BlackStateLeg Female RR_Tesler c.True_BlackStateLeg#c.RR_Tesler c.Belief_BlackStateLeg#c.RR_Tesler ///
		Ideology State_Ideology c.Ideology#c.State_Ideology  Congruence Republican Independent StrongPartisan StateKnowledge Age c.Age#c.Age Black CollegeDegree Employed Religiosity||State: , cov(uns)
		
		replace RRTeslerTemp=RR_Tesler
		replace RR_Tesler=CurrentRRValue
		margins, at((mean) RR_Tesler Belief_BlackStateLeg = (23 41)) contrast(atcontrast(r._at) nowald) post
		
		esttab using "Scripts/Figures/Estimates/Racial Resentment/StateLeg-RacialResentment-`CurrentRRValueForFile'.csv", label ci scalars(cmdline) nogaps nonumbers nostar replace
		replace RR_Tesler=RRTeslerTemp
		replace CurrentRRValue = CurrentRRValue+.1
		replace CurrentRRValueforFileValue = CurrentRRValueforFileValue+10
		local CurrentRRValueForFile = CurrentRRValueforFileValue
		}
		
		drop CurrentRRValue
		drop CurrentRRValueforFileValue
		drop RRTeslerTemp
		

		
***
* Estimates for Figure A-11
***	
* State Leg ~ Racial Resentment

		gen CurrentRRValue = 0
		gen CurrentRRValueforFileValue=0
		local CurrentRRValueForFile = CurrentRRValueforFileValue
		gen RRTeslerTemp =.

		forval i=1/11 {
		eststo clear		
		quietly meoprobit Trust_StateLeg_Pre True_BlackStateLeg Belief_BlackStateLeg Female RR_Tesler c.True_BlackStateLeg#c.RR_Tesler c.Belief_BlackStateLeg#c.RR_Tesler ///
		Ideology State_Ideology c.Ideology#c.State_Ideology  Congruence Republican Independent StrongPartisan StateKnowledge Age c.Age#c.Age Black CollegeDegree Employed Religiosity||State: , cov(uns)
		
		replace RRTeslerTemp=RR_Tesler
		replace RR_Tesler=CurrentRRValue
		margins, at((mean) RR_Tesler Belief_BlackStateLeg = (23 41)) contrast(atcontrast(r._at) nowald) post
		
		esttab using "Scripts/Figures/Estimates/Racial Resentment/StateLeg-Trust-RacialResentment-`CurrentRRValueForFile'.csv", label ci scalars(cmdline) nogaps nonumbers nostar replace
		replace RR_Tesler=RRTeslerTemp
		replace CurrentRRValue = CurrentRRValue+.1
		replace CurrentRRValueforFileValue = CurrentRRValueforFileValue+10
		local CurrentRRValueForFile = CurrentRRValueforFileValue
		}